<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
</head>

<body>
    <div id="app">
        <!-- <com1></com1>
        <com2></com2> -->
        <component :is="com"></component>
        <!-- 动态组件 -->
    </div>

</body>
<template id="com1">
    <div>
        组件一
    </div>
</template>
<template id="com2">
    <div>
        组件二
    </div>
</template>
<template id="com3">
    <div>
        组件三
    </div>
</template>

<script>
    let com1 = {
        template: "#com1"
    }
    let com2 = {
        template: "#com2"
    }

    let com3 = {
        template: "#com3"
    }




    new Vue({
        el: "#app",
        data: {
            com: "com1",
            activeIndex:1,
            list: [{ id: 1, msg: "菜单一", com: "com1" }, { id: 2, msg: "菜单二", com: "com2" }, { id: 3, msg: "菜单三", com: "com3" }]
        },
        components: {
            com1,
            com2,
            com3
        }
    })


</script>

</html>